package main
import (
	"fmt"
)

func cel(num1 float64,num2 float64,operate byte) float64 {
	var res float64
	switch operate{
		case '+':
			res = num1 + num2
		case '-':
			res = num1 - num2
		default:
			fmt.Println("操作符出错！")
	}
	return res
}

func main(){
	result := cel(1,2,'+')
	fmt.Println("result = ",result)
	result = cel(3,1,'-')
	fmt.Println("result = ",result)
}